
module windump.plugins.pstore.pstoreclib;

import std.c.windows.windows;
import std.c.windows.com;

struct _PST_PROVIDERINFO {
  uint cbSize;
  GUID ID;
  uint Capabilities;
  wchar* szProviderName;
}

struct _PST_TYPEINFO {
  uint cbSize;
  wchar* szDisplayName;
}

struct _PST_ACCESSRULESET {
  uint cbSize;
  uint cRules;
  _PST_ACCESSRULE* rgRules;
}

struct _PST_ACCESSRULE {
  uint cbSize;
  uint AccessModeFlags;
  uint cClauses;
  _PST_ACCESSCLAUSE* rgClauses;
}

struct _PST_ACCESSCLAUSE {
  uint cbSize;
  uint ClauseType;
  uint cbClauseData;
  ubyte* pbClauseData;
}

struct _PST_PROMPTINFO {
  uint cbSize;
  uint dwPromptFlags;
  uint hwndApp;
  wchar* szPrompt;
}

interface IEnumPStoreProviders : IUnknown {
  static GUID IID = { 0x5a6f1ebf, 0x2db1, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
  int Next(in uint celt, out _PST_PROVIDERINFO rgelt, inout uint pceltFetched);
  int Skip(in uint celt);
  int Reset();
  int Clone(out IEnumPStoreProviders ppenum);
}

interface IPStore : IUnknown {
  static GUID IID = { 0x5a6f1ec0, 0x2db1, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
  int GetInfo(out _PST_PROVIDERINFO ppProperties);
  int GetProvParam(in uint dwParam, out uint pcbData, out ubyte ppbData, in uint dwFlags);
  int SetProvParam(in uint dwParam, in uint cbData, in ubyte* pbData, in uint dwFlags);
  int CreateType(in uint Key, inout GUID pType, in _PST_TYPEINFO* pInfo, in uint dwFlags);
  int GetTypeInfo(in uint Key, inout GUID pType, out _PST_TYPEINFO ppInfo, in uint dwFlags);
  int DeleteType(in uint Key, inout GUID pType, in uint dwFlags);
  int CreateSubtype(in uint Key, inout GUID pType, inout GUID pSubtype, in _PST_TYPEINFO* pInfo, in _PST_ACCESSRULESET* pRules, in uint dwFlags);
  int GetSubtypeInfo(in uint Key, inout GUID pType, inout GUID pSubtype, out _PST_TYPEINFO ppInfo, in uint dwFlags);
  int DeleteSubtype(in uint Key, inout GUID pType, inout GUID pSubtype, in uint dwFlags);
  int ReadAccessRuleset(in uint Key, inout GUID pType, inout GUID pSubtype, out _PST_ACCESSRULESET ppRules, in uint dwFlags);
  int WriteAccessRuleset(in uint Key, inout GUID pType, inout GUID pSubtype, in _PST_ACCESSRULESET* pRules, in uint dwFlags);
  int EnumTypes(in uint Key, in uint dwFlags, in IEnumPStoreTypes* ppenum);
  int EnumSubtypes(in uint Key, inout GUID pType, in uint dwFlags, in IEnumPStoreTypes* ppenum);
  int DeleteItem(in uint Key, inout GUID pItemType, inout GUID pItemSubtype, in wchar* szItemName, in _PST_PROMPTINFO* pPromptInfo, in uint dwFlags);
  int ReadItem(in uint Key, inout GUID pItemType, inout GUID pItemSubtype, in wchar* szItemName, out uint pcbData, out ubyte* ppbData, in _PST_PROMPTINFO* pPromptInfo, in uint dwFlags);
  int WriteItem(in uint Key, inout GUID pItemType, inout GUID pItemSubtype, in wchar* szItemName, in uint cbData, in ubyte* pbData, in _PST_PROMPTINFO* pPromptInfo, in uint dwDefaultConfirmationStyle, in uint dwFlags);
  int OpenItem(in uint Key, inout GUID pItemType, inout GUID pItemSubtype, in wchar* szItemName, in uint ModeFlags, in _PST_PROMPTINFO* pPromptInfo, in uint dwFlags);
  int CloseItem(in uint Key, inout GUID pItemType, inout GUID pItemSubtype, in wchar* szItemName, in uint dwFlags);
  int EnumItems(in uint Key, inout GUID pItemType, inout GUID pItemSubtype, in uint dwFlags, in IEnumPStoreItems* ppenum);
}

interface IEnumPStoreTypes : IUnknown {
  static GUID IID = { 0x789c1cbf, 0x31ee, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
  int Next(in uint celt, out GUID rgelt, inout uint pceltFetched);
  int Skip(in uint celt);
  int Reset();
  int Clone(out IEnumPStoreTypes ppenum);
}

interface IEnumPStoreItems : IUnknown {
  static GUID IID = { 0x5a6f1ec1, 0x2db1, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
  int Next(in uint celt, out wchar* rgelt, inout uint pceltFetched);
  int Skip(in uint celt);
  int Reset();
  int Clone(out IEnumPStoreItems ppenum);
}

abstract class CPStore {
  static GUID CLSID = { 0x5a6f1ec3, 0x2db1, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
}

abstract class CEnumTypes {
  static GUID CLSID = { 0x09bb61e7, 0x31ec, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
}

abstract class CEnumItems {
  static GUID CLSID = { 0x09bb61e6, 0x31ec, 0x11d0, [0x8c, 0x39, 0x00, 0xc0, 0x4f, 0xd9, 0x12, 0x6b] };
}


enum : DWORD
{
    PST_PROMPT_QUERY = 0x00000008
}

alias GUID  PST_PROVIDERID;
